package com.itheima.app.controller;

import com.itheima.app.manager.PeachBlossomManager;
import com.itheima.domain.vo.VoiceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
public class PeachBlossomController {

    @Autowired
    private PeachBlossomManager peachBlossomManager;

    /**
     * 1.保存语音
     */
    @PostMapping("/peachblossom")
    public void saveVoice(MultipartFile soundFile) throws IOException {
        peachBlossomManager.saveVoice(soundFile);
    }

    /**
     * 2.接收语音
     */
    @GetMapping("/peachblossom")
    public VoiceVo findVoice(){
        return peachBlossomManager.findVoice();
    }
}
